package com.lottery.obtainData.SscYesWinningFactory;

import com.lottery.initData.InitData;

import java.util.ArrayList;
import java.util.List;

//北京赛车中奖集合获取
public class BJSCWinResult {
    public void init(String opencode) {
        InitData.BJSC_WINRESULT_MAP.clear();
        String[] split = opencode.split(",");
        List<Integer> list = new ArrayList(10);
        for (String aa : split) {
            list.add(Integer.parseInt(aa));
        }
        getDaxiao(list);
        getCaiCheHao(list);
        getlonghu(list);
        getZhuangXian(list);
        getGuanYa(list);
        getTema(list);
        getGuanYaHe(list);
    }
    //冠亚和
    private void getGuanYaHe(List<Integer> list) {
        List<String> strings = new ArrayList<>();
        Integer playwayId = 16;
        int num = list.get(0) + list.get(1);
        String numString = "";
        if(num<10){
            numString = "0"+num;
        }else{
            numString = num+"";
        }
        strings.add("和/"+numString);
        InitData.BJSC_WINRESULT_MAP.put(playwayId, strings);
    }

    //特码竞猜
    private void getTema(List<Integer> list) {
        List<String> strings = new ArrayList<>();
        Integer playwayId = 15;
        int num = list.get(0) + list.get(1);
        if(num>=12){
            strings.add("和/大");
        }else {
            strings.add("和/小");
        }
        if(num % 2 ==0){
            strings.add("和/双");
        }else{
            strings.add("和/单");
        }
        if(num >=3 && num <=7){
            strings.add("A");
        }else if(num >=8 && num <= 14){
            strings.add("B");
        }else{
            strings.add("C");
        }
        InitData.BJSC_WINRESULT_MAP.put(playwayId, strings);
    }

    //猜冠亚号码
    private void getGuanYa(List<Integer> list) {
        List<String> strings = new ArrayList<>();
        Integer playwayId = 14;
        int first = list.get(0);
        int two = list.get(1);
        if(first == 10){
            first = 0;
        }
        if(two == 10){
            two = 0;
        }
        strings.add("组/" + first + "" + two);
        strings.add("组/" + two + "" + first);
        InitData.BJSC_WINRESULT_MAP.put(playwayId, strings);
    }


    //猜庄闲
    private void getZhuangXian(List<Integer> list) {
        List<String> strings = new ArrayList<>();
        Integer playwayId = 13;
        int first = list.get(0);
        int two = list.get(1);
        if (first > two) {
            strings.add("庄");
        } else {
            strings.add("闲");
        }
        InitData.BJSC_WINRESULT_MAP.put(playwayId, strings);
    }

    //猜龙虎玩法
    private void getlonghu(List<Integer> list) {
        List<String> strings = new ArrayList<>();
        Integer playwayId = 12;
        for (int i = 1; i <= 5; i++) {
            int first = list.get(i - 1);
            int end = list.get(10 - i);
            if (first > end) {
                strings.add(i + "/龙");
            } else {
                strings.add(i + "/虎");
            }
        }
        InitData.BJSC_WINRESULT_MAP.put(playwayId, strings);
    }

    //猜车号玩法
    private void getCaiCheHao(List<Integer> list) {
        List<String> strings = new ArrayList<>();
        Integer playwayId = 11;
        for (int i = 1; i <= 10; i++) {
            int cedao = list.get(i - 1);
            int index = i;
            if(index==10){
                index=0;
            }
            if(cedao == 10){
                cedao=0;
            }
            strings.add( index + "/" + cedao);
        }
        InitData.BJSC_WINRESULT_MAP.put(playwayId, strings);
    }

    //大小单双玩法
    private void getDaxiao(List<Integer> list) {
        List<String> strings = new ArrayList<>();
        Integer playwayId = 10;
        for (int i = 1; i <= 10; i++) {
            int index = i;
            if(index == 10){
                index =0;
            }
            int a = list.get(i - 1);
            if (a <= 5) {
                strings.add(index + "/小");
                if (a % 2 == 0) {
                    strings.add(index + "/小双");
                } else {
                    strings.add(index + "/小单");
                }
            } else {
                strings.add(index + "/大");
                if (a % 2 == 0) {
                    strings.add(index + "/大双");
                } else {
                    strings.add(index + "/大单");
                }
            }
            if (a % 2 == 0) {
                strings.add(index + "/双");
            } else {
                strings.add(index + "/单");
            }
        }
        InitData.BJSC_WINRESULT_MAP.put(playwayId, strings);
    }


}
